package com.whfc.cncit.helmet.codec;


import com.whfc.cncit.constant.CncitConst;
import com.whfc.cncit.entity.CncitDwMsgRA;
import com.whfc.iot.util.ByteUtil;

/**
 * @Description:
 * @author: xugcheng
 * @version: 1.0
 * @date: 2019/10/25 16:07
 */
public class CncitDwMsgCodecRA implements CncitMsgCodec<CncitDwMsgRA> {

    @Override
    public CncitDwMsgRA decode(String data) {
        return null;
    }

    @Override
    public String encode(CncitDwMsgRA msg) {
        String data = null;
        //$08,RA,0,1,#\n
        String dataLengthStr = ByteUtil.toHexString(msg.getDataLength());
        data = String.format("$%s,%s,%s,%s,#", dataLengthStr, msg.getCmd(), CncitConst.PLATFORM, msg.getResult());
        return data;
    }
}
